<?php
	require_once('include/user.class.php');
	
	User::start();
	if($_GET['logout']=='yes')
	{
		User::logout();
		header("Location: index.php?logout=yes");
	}
	else if (isset($_POST['user']))
	{
		try
		{
			User::loginAs($_POST['user'],$_POST['pass']);
			header("Location: index.php?login=yes");
		}
		catch(Exception $e)
		{
			header("Location: index.php?login=no");
		}
	}
	else header("Location: index.php");
?>